Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cert: Add AS certificate #2936

Merged
merged 2 commits into from
Jul 30, 2019
Merged

cert: Add AS certificate #2936

merged 2 commits into from
Jul 30, 2019

Conversation

oncilla
Copy link
Contributor

@oncilla oncilla commented Jul 30, 2019

This PR adds the AS certificate with parsing and validation.

contributes to #2853


This change is Reviewable

@oncilla oncilla added the c/CPPKI SCION Control-plane PKI label Jul 30, 2019
@oncilla oncilla added this to the Q3S2 milestone Jul 30, 2019
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6 of 6 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @oncilla)


go/lib/scrypto/cert/v2/base_json_test.go, line 38 at r1 (raw file):

		"Valid": {
			Modify:         func(_ *genCert) {},
			ModifyExpected: func(_ *cert.AS) {},

Hm this will not work for cert.Issuer. I also think it is a bit weird the base_json_test tests concrete implementations.
How about having the functionality for testing here and actually call it in the implementation tests:

type baseTest struct {
		Modify         func(*genCert)
                ExpectedErrMsg string
}

func baseUnmarshalJSONTests() map[string]baseTest {
 return map[string]baseTest{
		"Subject not set": {
			Modify: func(g *genCert) {
				g.Subject = nil
			},
			ExpectedErrMsg: cert.ErrSubjectNotSet.Error(),
              }
     }
}

and in as_json_test.go

type asTest struct {
		baseTest
                ModifyExpected func(*cert.AS)
        }

func TestASUnmarshalJSON(t *testing.T) {
	tests := map[string]asTest{...}
        for name, bt := range baseUnmarshalJSONTests() {
               tests[name] = asTest{baseTest: bt}
        }
        for name, test := range tests {
              // test
}

Copy link
Contributor Author

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @lukedirtwalker)


go/lib/scrypto/cert/v2/base_json_test.go, line 38 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Hm this will not work for cert.Issuer. I also think it is a bit weird the base_json_test tests concrete implementations.
How about having the functionality for testing here and actually call it in the implementation tests:

type baseTest struct {
		Modify         func(*genCert)
                ExpectedErrMsg string
}

func baseUnmarshalJSONTests() map[string]baseTest {
 return map[string]baseTest{
		"Subject not set": {
			Modify: func(g *genCert) {
				g.Subject = nil
			},
			ExpectedErrMsg: cert.ErrSubjectNotSet.Error(),
              }
     }
}

and in as_json_test.go

type asTest struct {
		baseTest
                ModifyExpected func(*cert.AS)
        }

func TestASUnmarshalJSON(t *testing.T) {
	tests := map[string]asTest{...}
        for name, bt := range baseUnmarshalJSONTests() {
               tests[name] = asTest{baseTest: bt}
        }
        for name, test := range tests {
              // test
}

</blockquote></details>

Done.


<!-- Sent from Reviewable.io -->

This PR adds the AS certificate with parsing and validation.

contributes to scionproto#2853
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@oncilla oncilla merged commit a0058c7 into scionproto:master Jul 30, 2019
@oncilla oncilla deleted the pub-as-cert branch July 30, 2019 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/CPPKI SCION Control-plane PKI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants